//
//  HomeFilterViewController.m
//  Btpin
//
//  Created by Vic on 2019/12/10.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "HomeFilterViewController.h"

#import "LYSegmentView.h"
#import "LYFirstTestController.h"
#import "SelcetCityViewController.h"

@interface HomeFilterViewController ()<LYSegmentViewDelegate>
@property (nonatomic, strong) LYFirstTestController *firstVC;
@property (nonatomic, strong) SelcetCityViewController *SCVC;
@property (strong, nonatomic) UIView *currentView;
@end

@implementation HomeFilterViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self creatTitleView];
    [self createSubview];
}
- (void)creatTitleView{
    LYSegmentView *segmentView = [[LYSegmentView alloc] initWithFrame:CGRectMake(0, 0, 200*Scale, 30)];
    segmentView.delegate = self;
    [segmentView setSegmentWithBackground:[UIColor whiteColor] titleArray:@[@"初步沟通", @"复试邀请"] titleFont:FontBold(Font_18) titleLineSelectColor:THEMECOLOR_OF_TEXT_333333 normal:THEMECOLOR_OF_TEXT_9a9a9a withselectedIndex:0];
//    [segmentView setRightTopLabelWithAry:@[@"1", @"0"]];
    [segmentView setRightTopLabelWithAry:@[@"0", @"0"]];
    self.navigationItem.titleView = segmentView;
}

- (void)createSubview{
    _firstVC = [[LYFirstTestController alloc] init];
    [self addChildViewController:_firstVC];
    
    _SCVC = [[SelcetCityViewController alloc] init];
    [self addChildViewController:_SCVC];
    
    self.currentView = _firstVC.view;
    [self.view addSubview:_firstVC.view];
}

#pragma mark -- Action
- (void)customSegmentedValueChanged:(UISegmentedControl *)segment{
    NSLog(@"点击button----%ld",segment.selectedSegmentIndex);
    [self.currentView removeFromSuperview];
    switch (segment.selectedSegmentIndex) {
        case 0: {
            [self.view addSubview:_firstVC.view];
            self.currentView = _firstVC.view;
        } break;
        case 1: {
            [self.view addSubview:_SCVC.view];
            self.currentView = _SCVC.view;
        } break;
        default:
            break;
    }
}

@end
